package fc.sj.study.activity;

import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TimePicker;

import com.zhy.http.okhttp.callback.StringCallback;

import java.util.Calendar;

import fc.sj.study.Collector.ActivityCollector;
import fc.sj.study.R;
import fc.sj.study.utils.LogUtil;
import fc.sj.study.utils.OkHttpUtil;
import okhttp3.Call;

public class MainActivity extends AppCompatActivity{
    private int hour, minute;
    private Calendar cal;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        cal = Calendar.getInstance();
        hour = cal.get(Calendar.HOUR_OF_DAY);
        minute = cal.get(Calendar.MINUTE);
        OkHttpUtil okHttpUtil=new OkHttpUtil();
        okHttpUtil.test(new StringCallback() {
            @Override
            public void onError(Call call, Exception e, int id) {
                LogUtil.e("TAG","1");
            }

            @Override
            public void onResponse(String response, int id) {
                LogUtil.e("TAG","1");
            }
        });


    }
    public void one(View view){
        Intent intent=new Intent(this,LoginMvpActivity.class);
        startActivity(intent);
    }

    public void two(View view){
        new TimePickerDialog(this, new TimePickerDialog.OnTimeSetListener() {
            @Override
            public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                setTitle(hourOfDay+":"+minute);
            }
        }, hour, minute, true).show();
    }
    //退出功能
    public void exit(View view){
        ActivityCollector.FinishAllActivity();
//        //杀死所有进程
//        android.os.Process.killProcess(android.os.Process.myPid());
    }

    public static void actionStart(Context context,String param1,String param2){
        Intent intent=new Intent(context,Main2Activity.class);
        intent.putExtra("param1",param1);
        intent.putExtra("param2",param2);
        context.startActivity(intent);
    }
}
